package test01;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        System.out.println("请输入姓名");
        String name = s.nextLine();
        System.out.println("请输入密码");
        String pwd = s.nextLine();
        System.out.println("请输入nick");
        String nick = s.nextLine();
        System.out.println("请输入年龄");
        int age = s.nextInt();
        User p = new User(name,pwd,nick,age);

        FileOutputStream fos = new FileOutputStream(name+".obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);

        oos.writeObject(p);
        System.out.println("写出成功");
        oos.close();
    }
}
